import request from '../utils/request.js'

// 获取歌单详情
// 这个要传cookie,即需要登录 ----后续解决:已经不用传了,知道怎么让axios携带cookie了(但还是一知半解而已)
export const getPlayListSongs = (id) => {
  return request({
    method: 'GET',
    url: '/playlist/detail',
    params: { id }
  })
}

// 获取歌单所有歌曲,为啥我获取歌单详情就已经给我把歌都弄回来了
// 回复上面疑问,原来是自己的歌单就是全都弄出来了,别人的就只给一部分
export const getPlayListAllSongs = (id, limit, offset) => {
  return request({
    method: 'GET',
    url: '/playlist/track/all',
    params: { id, limit, offset }
  })
}

// 歌单详情动态,这个不用传cookie,即不需要登录
export const getPlayListDynamic = (id) => {
  // return request.get('/playlist/detail/dynamic', { id })这样写似乎有问题
  return request({
    method: 'GET',
    url: '/playlist/detail/dynamic',
    params: { id }
  })
}

// 获取歌单的收藏着
export const getPlayListSubscribers = (id, limit, offset) => {
  return request({
    method: 'GET',
    url: '/playlist/subscribers',
    params: { id, limit, offset }
  })
}

// 获取该歌单的相关歌单推荐
export const getRelatedPlayList = (id) => {
  return request({
    method: 'GET',
    url: '/related/playlist',
    params: { id }
  })
}

//  获取排行榜信息
export const getToplist = () => {
  return request({
    method: 'GET',
    url: '/toplist'
  })
}
//  获取排行榜详细
export const getTopDetail = () => {
  return request({
    method: 'GET',
    url: '/toplist/detail'
  })
}

// 获取歌单分类
export const getPlayListCate = () => {
  return request({
    method: 'GET',
    url: '/playlist/catlist'
  })
}
// 获取热门歌单分类
export const getHotCate = () => {
  return request({
    method: 'GET',
    url: '/playlist/hot'
  })
}

// 根据分类获取歌单
export const getPlayListByCate = ({ order = 'hot', cat, limit = 50, offset }) => {
  return request({
    method: 'GET',
    url: '/top/playlist',
    params: { order, cat, limit, offset }
  })
}

// 精品歌单标签列表
export const getHighTags = () => {
  return request({
    method: 'GET',
    url: '/playlist/highquality/tags'
  })
}

// 获取精品歌单
export const getHighPlayList = (cat = '全部', limit, before) => {
  return request({
    method: 'GET',
    url: '/top/playlist/highquality',
    params: { cat, limit, before }
  })
}
